<template>
	<div class="mine">
		<div class="box">
			<div class="info-block">
				<div class="top">
					<div class="player">{{$t('indexTitle.title232')}} {{info.name}}</div>
					<div class="right-block" @click="loginOut">{{$t('indexTitle.title212')}}</div>
				</div>
				<div class="center">
					<div class="currency">HKD</div>
					<!-- <div @click="goNextPage('/turntable')">转盘</div> -->
					<div class="balance" @click="getrefresh">
						{{info.money||0}}
						<img src="../../assets/images/shuaxin.png" alt="" :class="{ ssssxuanzhuan: isrefresh }" />
					</div>
				</div>
			</div>
			<div class="func-btn-block">
				<div class="fbb-item" @click="goNextPage('/deposit')">
					<div class="icon">
						<img src="../../assets/icons/chongzhi.jpg" alt="" />
					</div>
					<div style="font-size: 13px;">{{$t('indexTitle.title26')}}</div>
				</div>
				<div class="fbb-item" @click="goNextPage('/withdraw')">
					<div class="icon">
						<img src="../../assets/icons/tixian.jpg" alt="" />
					</div>
					<div style="font-size: 13px;">{{$t('indexTitle.title27')}}</div>
				</div>
				<div class="fbb-item" @click="goNextPage('/finan-history')">
					<div class="icon">
						<img src="../../assets/icons/caiwujilu.png" alt="" />
					</div>
					<div style="font-size: 13px;">{{$t('indexTitle.title32')}}</div>
				</div>
				<div class="fbb-item" @click="goNextPage('/game-history')">
					<div class="icon">
						<img src="../../assets/icons/youxijilu.png" alt="" />
					</div>
					<div style="font-size: 13px;">{{$t('indexTitle.title31')}}</div>
				</div>
			</div>
			<div class="menu-block">
				<div class="mbitem" @click="goNextPage('/profile')">
					<img src="../../assets/icons/gerenziliao.png" alt="" />
					<div class="label">{{$t('indexTitle.title123')}}</div>
				</div>
				<!-- <div class="mbitem" @click="goNextPage('/vip')">
					<img src="../../assets/icons/vip.png" alt="" />
					<div class="label">{{$t('indexTitle.title25')}}</div>
				</div> -->
				<div class="mbitem" @click="goNextPage('/vipRebates')">
					<img src="../../assets/icons/vip.png" alt="" />
					<div class="label">{{$t('indexTitle.title328')}}</div>
				</div>
				<!-- <div class="mbitem" @click="goNextPage('/affiliate')">
					<img src="../../assets/icons/tuiguangfenxiao.png" alt="" />
					<div class="label">{{$t('indexTitle.title28')}}</div>
				</div> -->
				<div class="mbitem" @click="goNextPage('/promotions')">
					<img src="../../assets/icons/youhuizhongxin.png" alt="" />
					<div class="label">{{$t('indexTitle.title30')}}</div>
				</div>
				<div class="mbitem" @click="goNextPage('/mywallet')">
					<img src="../../assets/icons/suoyouqianbao.png" alt="" />
					<div class="label">{{$t('indexTitle.title125')}}</div>
				</div>
				<div class="mbitem" @click="goNextPage('/bankcards')">
					<img src="../../assets/icons/yinhangka.png" alt="" />
					<div class="label">{{$t('indexTitle.title233')}}</div>
				</div>
				<div class="mbitem" @click="goNextPage('/mission')">
					<img src="../../assets/icons/renwurizhi.png" alt="" />
					<div class="label">{{$t('indexTitle.title29')}}</div>
				</div>
				<div class="mbitem" @click="goNextPage('/appDownload')">
					<img src="../../assets/icons/shoujixiazai.png" alt="" />
					<div class="label">{{$t('indexTitle.title3')}}</div>
				</div>
				<div class="mbitem" @click="goNextPage('/personalMsg')">
					<img src="../../assets/icons/gonggaozhongxin.png" alt="" />
					<div class="label">{{$t('indexTitle.title33')}}</div>
				</div>
				<!-- <div class="mbitem" @click="goNextPage('/helpcenter')">
					<img src="../../assets/icons/bangzhu.png" alt="" />
					<div class="label">{{$t('indexTitle.title230')}}</div>
				</div> -->
			</div>
		</div>
		<!-- <div class="buttons">
			<img src="../../assets/images/xiaoxi.png" alt="" />
		</div> -->
		<!-- <div class="event-qmenu" :class="close ? 'close' : ''">
			<div class="handle" @click="close=!close">
				<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 70">
					<path
						d="M0,1.3l0,67.4c0.5-1.3,1.2-2.6,1.9-3.8c2-3.3,4.2-5.7,8.4-9.6l1.5-1.4C19.3,47,22,42.8,22,35s-2.7-12-10.2-18.9c-0.2-0.2-1.2-1.1-1.5-1.4c-4.2-3.9-6.5-6.3-8.4-9.6C1.2,3.9,0.5,2.6,0,1.3L0,1.3z">
					</path>
		
				</svg>
				<img src="../../assets/images/jiantoudsd.png" alt="" v-if="close">
				<img src="../../assets/images/jiantouxxx.png" alt="" v-if="!close">
			</div>
		
			<div class="cont">
				<div class="event-item" @click="getNextPage('/mission')">
					<img src="../../assets/images/1.webp" alt="" />
				</div>
				<div class="event-item">
					<img src="../../assets/images/2.png" alt="" />
				</div>
				<div class="event-item" @click="getNextPage('/turntable')">
					<img src="../../assets/images/3.webp" alt="" />
				</div>
			</div>
		</div> -->
		<loadingFour :msgText="msgTextTow" v-if="isShowLoadingTeow" @closeGuanbiTow="closeGuanbi"></loadingFour>
		<bottom :isSelNav='4'></bottom>
	</div>
</template>

<script>
	import bottom from '../../components/bottom.vue'
	import loadingFour from '../../components/loadingFour.vue';
	import {
		userinfo
	} from "../../utils/api.js"
	export default {
		components: {
			bottom,
			loadingFour
		},
		data() {
			return {
				close: true,
				info: [],
				infoTow: [],
				isrefresh: false,
				msgTextTow: "",
				isShowLoadingTeow: false
			}
		},
		created() {},
		mounted() {
			if (localStorage.getItem("userInfo")) {
				this.info = JSON.parse(localStorage.getItem('userInfo'))
			}
			this.getuserinfo()
		},
		methods: {
			closeGuanbi(e) {
				this.isShowLoadingTeow = false;
			},
			getNextPage(page) {
				if (localStorage.getItem('token')) {
					this.$router.push(page)
				} else {
					this.$router.push('/login')
				}
			},
			getrefresh() {
				this.isrefresh = true;
				this.getuserinfo();
			},
			getuserinfo() {
				userinfo().then((res) => {
					if (res.status.errorCode == 0) {
						if (res.data) {
							localStorage.setItem('userInfo', JSON.stringify(res.data))
							this.info = res.data
							this.isrefresh = false;
						}
					} else if (res.status.errorCode == 401) {
						console.log('401')
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
							setTimeout(()=>{
								this.isShowLoadingTeow = false;
							},2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			loginOut() {
				localStorage.removeItem('token');
				localStorage.removeItem('siteTitle');
				localStorage.removeItem('siteIco');
				if (localStorage.getItem('languageTow')) {
					localStorage.removeItem('languageTow');
				}
				if (localStorage.getItem('language')) {
					localStorage.removeItem('language');
				}
				if (localStorage.getItem('userInfo')) {
					localStorage.removeItem('userInfo');
				}
				if (localStorage.getItem('tongjilistTow')) {
					localStorage.removeItem('tongjilistTow');
				}
				// window.location.reload()
				this.$router.push('/login')
			},
			goNextPage(page) {
				console.log(page);
				// return false;
				this.$router.push(page)
			}
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
	}

	.mine {
		/* height: -webkit-fill-available;
		height: 90vh;
		overflow-y: scroll;
		padding-bottom: calc(50px + env(safe-area-inset-bottom));
	 padding-bottom: 150px;  */
		height: 90vh;
		overflow-y: auto;
		overflow-x: hidden;
		padding-bottom: calc(50px + env(safe-area-inset-bottom));
		padding-top: calc(constant(safe-area-inset-top) + 0px);
		padding-top: calc(env(safe-area-inset-top) + 0px);
		padding-bottom: calc(constant(safe-area-inset-bottom) + 85px);
		padding-bottom: calc(env(safe-area-inset-bottom) + 85px);
		box-sizing: border-box;
		position: fixed;
		z-index: 1;
		-webkit-overflow-scrolling: touch;
		width: 100%;
	}

	.box {
		background-color: #f1f1f1;
		display: flex;
		flex-direction: column;
		/* min-height: 100vh; */
	}

	.info-block {
		background: linear-gradient(180deg, #7240ff, #9240ff);
		border-radius: 0 0 30px 30px;
		color: #fff;
		font-weight: 400;
		margin-bottom: 15px;
		padding: 20px;
		position: relative;
	}

	.info-block::before {
		background: url('../../assets/images/userinfo.webp') 50%/cover no-repeat;
		content: "";
		height: 100%;
		left: 0;
		opacity: .8;
		position: absolute;
		top: 0;
		width: 100%;
		z-index: 1;
	}

	.top {
		display: flex;
		justify-content: space-between;
		position: relative;
		z-index: 2;
	}

	.right-block {
		align-items: center;
		display: flex;
	}

	.center {
		padding-top: 20px;
		position: relative;
		z-index: 2;
	}

	.currency {
		font-size: 14px;
		margin-bottom: 5px;
		opacity: .6;
	}

	.balance {
		align-items: center;
		display: flex;
		font-size: 32px;
	}

	.balance img {
		width: 24px;
		height: 24px;
		margin-left: 5px;
	}

	.ssssxuanzhuan {
		animation: rotatefresh 1s;
	}

	@keyframes rotatefresh {
		from {
			transform: rotate(0deg);
		}

		to {
			transform: rotate(360deg);
			transition: all 0.4s;
		}
	}

	.func-btn-block {
		display: flex;
		justify-content: center;
		margin-bottom: 20px;
	}

	.fbb-item {
		align-items: center;
		background: transparent;
		color: #545658;
		display: flex;
		flex: 1;
		flex-direction: column;
		font-weight: 400;
		height: auto;
		width: auto;
		border-radius: 3px;
		font-size: 16px;
	}

	.icon {
		align-items: center;
		background: #fff;
		border-radius: 15px;
		display: flex;
		font-size: 30px;
		height: 60px;
		justify-content: center;
		margin-bottom: 8px;
		width: 60px;
	}

	.icon img {
		width: 25px;
		height: 25px;
	}

	.menu-block {
		background: #fff;
		border-radius: 30px 30px 0 0;
		padding: 15px 20px;
		padding-bottom: 75px;
	}

	.mbitem {
		align-items: center;
		color: #545658;
		display: flex;
		font-size: 15px;
		padding: 10px 0;
		position: relative;
		border-bottom: 1px solid #ececec;
	}

	.mbitem:last-child {
		border-bottom: 0;
	}

	.mbitem img {
		width: 25px;
		height: 25px;
		margin-right: 12.5px;
	}

	.label {
		color: #545658;
		font-size: 15px;
	}

	.buttons {
		position: fixed;
		bottom: 10%;
		right: 10px;
		background-color: #99D2E3;
		width: 60px;
		height: 60px;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.buttons img {
		width: 32px;
		height: 32px;
	}

	.event-qmenu {
		bottom: 100px;
		height: auto !important;
		left: 0;
		min-height: auto !important;
		position: fixed;
		transition: .3s ease;
		width: 100px;
		z-index: 21;
	}

	.event-qmenu.close {
		transform: translateX(-73px);
	}

	.handle {
		bottom: 5px;
		height: 84px;
		position: absolute;
		right: 3px;
		width: 30px;
	}

	.handle img {
		bottom: 28px;
		position: absolute;
		right: 3px;
		width: 25px;
		height: 25px;
	}

	svg:not(:root) {
		overflow: hidden;
	}

	.event-qmenu .handle path {
		fill: #7240ff;
	}

	/* .handle::after{
		speak: none;
		color: #fff;
		content: ">";
		font-family: iconmps!important;
		font-size: 20px;
		font-style: normal;
		font-variant: normal;
		font-weight: 400;
		left: -2px;
		line-height: 1;
		position: absolute;
		text-align: center;
		text-shadow: 0 -1px 3px #4c0dff;
		text-transform: none;
		top: 50%;
		transform: translateY(-50%) rotate(180deg);
		width: 30px;
	} */
	.event-qmenu.close .handle::after {
		left: 0px;
		text-shadow: 0 1px 3px #4c0dff;
		transform: translateY(-50%) rotate(0deg);
	}

	@keyframes aqm {
		0% {
			box-shadow: 0 2px 6px rgba(0, 0, 0, .8);
		}

		55% {
			box-shadow: 0 2px 4px #aa8dff;
		}

		70% {
			box-shadow: 0 2px 4px #bda6ff;
		}

		100% {
			box-shadow: 0 2px 6px rgba(0, 0, 0, .8);
		}
	}

	.cont {
		align-items: center;
		animation: aqm 1.8s ease infinite;
		background-color: rgba(0, 0, 0, .8);
		border: 3px solid #7240ff;
		border-bottom-right-radius: 15px;
		border-left: 0;
		border-top-right-radius: 15px;
		box-shadow: 0 2px 6px rgba(0, 0, 0, .8);
		display: flex;
		flex-wrap: wrap;
		min-height: 103px;
		padding: 10px;
		width: 70px;
	}

	.event-item {
		align-items: center;
		display: flex;
		height: 50px;
		justify-content: center;
		margin: 5px 0;
		position: relative;
		transition: .3s ease;
		width: 50px;
	}

	.event-item img {
		display: block;
		max-height: 100%;
		max-width: 100%;
	}
</style>